package com.cms.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.cms.model.vo.SysUserRole;

import tk.mybatis.mapper.common.Mapper;

public interface SysUserRoleDao extends Mapper<SysUserRole>{

	@Select("select user_role_id, user_id, role_id, creator, create_time from sys_user_role where user_id = #{userId,jdbcType=INTEGER}")
	List<SysUserRole> selectUserRolesListByUserId(@Param("userId") Integer userId);
	
	@Delete("delete from sys_user_role where role_id in (${roleIds})")
	void deleteUserRoleByRoleId(@Param("roleIds") String roleIds);

	@Delete("delete from sys_user_role where user_id in (${userIds})")
	void deleteUserRoleByUserId(@Param("userIds") String  userIds);
	
	@Select("select role_id from sys_user_role where user_id = #{userId,jdbcType=INTEGER}")
	List<Integer> selectUserRoleByUserId(@Param("userId") Integer  userId);
}
